declare class BetterGet {
  get<U extends T, T>(section: string, defaultValue: U | T): T;
}

const betterGet = new BetterGet();

betterGet.get("section", "defaultValue");
//         ^?

type _bg = unknown | "defaultValue";
/// //////
declare class BetterGetConst {
  get<const T>(section: string, defaultValue: T): T;
}

const betterGetConst = new BetterGetConst();

betterGetConst.get("section", "defaultValue");
//             ^?

/// ///////////
declare class BetterGet2 {
  get<U extends T, T>(section: string, defaultValue: U & T): T;
}

const betterGet2 = new BetterGet2();

betterGet2.get("section", "defaultValue");
//         ^?

type _bg2 = unknown & "defaultValue";

declare class BetterGetRet {
  get<U extends T, T>(section: string, defaultValue: T): U & T;
}

const betterGetRet = new BetterGetRet();

betterGetRet.get("section", "defaultValue");
//            ^?
